import torch
import cv2
from matplotlib import pyplot as plt
from torch.nn import functional as F

a = [
[301.3448122615333, 354.3148280441562, 49.9],
[422.46704640709936, 371.50109099724324, 48.9],
[490.39370474549105, 426.3334537523305,52.8],
[507.5799676985781 ,484.4393904032439,47.7],
[578.780199932796, 559.7315900072444,47.1],
[586.1457411984047 ,426.3334537523305,43.1],
[668.803482068014 ,463.9795535543308,45.3],
[648.3436452191008, 391.96092784615644,43.3],
[664.7115146982313, 373.1378779451563,42.7],
[702.3576145002315, 379.6850257368085,28.3],
[721.9990578751882 ,267.5651198047643,38.8],
[738.3669273543187 ,329.7630238254604,33.3],
[767.0106989427973 ,438.6093558616784,37.9],
[790.7441096875365 ,296.20889139324277,47.4],
[901.2272286716676, 252.0156437995903,33.0],
[875.8570309790153, 347.76768025250396,28.4],
[864.399522343624 ,449.24847102311327,35.3],
[900.408835197711 ,463.16116008037426,29.5],
[917.5950981507982 ,514.7199489396354,29.0],
[953.6044110048853 ,531.0878184187659,45.1],
[926.5974263643201 ,375.5930583670259,33.9],
[973.245854379842 ,365.77233667954755,38.0],
[966.6987065881898 ,318.305515190069,47.1],
[1071.4530712546252, 308.48479350259066,30.5],
[1068.9978908327557, 454.15883186685244,36.9],
[1148.3820578065388, 397.68968216385207,37.8],
[1195.0304858220607, 468.88991439806995,51.8],
[1188.4833380304085 ,517.175129361505,36.9],
]


def onclick(event):
    x = event.xdata
    y = event.ydata
    print(x, y)

ig = cv2.imread('ss.png')
ig = cv2.cvtColor(ig, cv2.COLOR_BGR2RGB)
for v in a:
    cv2.circle(ig, center=(int(v[0]+1280),int(v[1])),radius=13,  color=(0, 0, 255),thickness=2)
    cv2.putText(ig, text=str(v[2]), org=(int(v[0]+1280),int(v[1])), fontFace=cv2.FONT_HERSHEY_SIMPLEX,fontScale=1, color=(255,0,0),thickness=2)




fig, ax = plt.subplots()


cid = fig.canvas.mpl_connect('button_press_event', onclick)

plt.imshow(ig)
plt.show()